import { CreateCommand } from "~/lib/server";
import type { Route } from "./+types/command";

export async function clientAction({ request }: Route.ActionArgs) {
    const formData = await request.formData();
    // const data = Object.fromEntries(formData);

    const data = {
        commandType: +(formData.get("commandType") || 0),
        command: formData.get("command"),
        data: formData.get("data"),
        node: formData.get("node"),
        device: formData.get("device"),
    }
    const response = await CreateCommand(data);

    return response

}